/*
 * adc.c
 *
 *  Created on: Apr 4, 2022
 *      Author: ABC
 */

#include "config.h"

int get_adc(ADC_HandleTypeDef adc)
{

	HAL_ADC_Start(&adc);
	HAL_ADC_PollForConversion(&adc,50);
	if(HAL_IS_BIT_SET(HAL_ADC_GetState(&adc),HAL_ADC_STATE_REG_EOC))
	{
	    return HAL_ADC_GetValue(&adc);
	}
	    return 0;
}

